Coder Social home page Coder Social logo

agontuk / react-native-collapsible-toolbar Goto Github PK

View Code? Open in Web Editor NEW
56.0 4.0 13.0 7.51 MB

Pure JS based collapsible toolbar for react native on Android and iOS

License: MIT License

JavaScript 59.18% Python 11.09% Java 7.54% Objective-C 22.20%
react-native collapsible toolbar collapsible-navbar react ios android

react-native-collapsible-toolbar's Introduction

react-native-collapsible-toolbar

Pure JS based collapsible toolbar for react native on Android and iOS.

Demo

Installation

yarn add react-native-collapsible-toolbar

Usage

import { Platform } from 'react-native';
import CollapsibleToolbar from 'react-native-collapsible-toolbar';

...
<CollapsibleToolbar
    renderContent={this.renderContent}
    renderNavBar={this.renderNavBar}
    renderToolBar={this.renderToolBar}
    imageSource='https://lorempixel.com/400/300/'
    collapsedNavBarBackgroundColor='#009688'
    translucentStatusBar={Platform.Version >= 21}
    toolBarHeight={300}
/>
...

Available props

Either an image source or a custom toolbar component must be provided

Name Type Default Description
collapsedNavBarBackgroundColor String '#FFF' Navbar background color when it's collapsed
imageSource String - Image to render as collapsible component
onContentScroll Function - The scroll event
renderContent Function REQUIRED Content to render below the collapsible toolbar
renderNavBar Function REQUIRED Transparent nav bar to render on top of the toolbar
renderToolBar Function - Custom toolbar component (will override imageSource)
toolBarHeight Number 300 Height of the collpasible toolbar
translucentStatusBar Boolean false If true, will adjust the nav bar position for Android

All the ScrollView props are also supported.

react-native-collapsible-toolbar's People

Contributors

agontuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

react-native-collapsible-toolbar's Issues

iPhone X

There is an incompatibility with the iPhone X.
I modified the package slightly to fix the issue:

const isIphoneX = () => {
    let d = Dimensions.get("window");
    const { height, width } = d;
    const result = height === 812 ? 74 : 44;
    return result;
};

...

const APPBAR_HEIGHT = Platform.OS === "ios" ? isIphoneX() : 56;

Scroll view not working

Scroll view within another component which is added to the main component which has the collapsible header not working

<View style={styles.MainContainer}>

                <CollapsibleToolbar
                    renderNavBar={this.renderNavBar}
                    renderToolBar={this.renderSearch}
                    renderContent={this.renderContent}  // a component from another component that has the scrollview in it
                    collapsedNavBarBackgroundColor='#009688'
                    translucentStatusBar={Platform.Version >= 21}
                    toolBarHeight={300}
                />

</View>

the scrollview works if not using your library

Module break, not scrolling

@Agontuk :
Hi, I tried the form here is the example link: https://snack.expo.io/Syb27TlvM
As you can see, it does not allow the elements in the tab to be scrolled.
I would also like the tab to crash when the toolbar reaches the minimum height.
That is, it should scroll only the elements of the tab, without scrolling the tab.
How can I do?

renderToolbar not loading any views

Hi, I have tried to use the renderToolbar method to design my collapsible but only the image in imageSource is rendered, regardless of what I do. If I remove the imageSource prop then my app breaks, telling me "Either an imageSource or custom component is required".

How can I avoid the imageSource and design my toolbar using the renderToolbar method itself?

local imageSource

Is there anyway to use a local file ie require("../../../app/images/my_image.png") for the image source prop? I've tried the following:

require("../../../app/images/my_image.png")
("../../../app/images/my_image.png")
"../../../app/images/my_image.png"

None of those seem to work.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.