Created
October 4, 2018 02:03
-
-
Save testshallpass/d76c656874e417bef4e0e6a63fc492af to your computer and use it in GitHub Desktop.
DropdownHolder Example #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class App extends React.Component { | |
render() { | |
return ( | |
<View style={{width: '100%', height: '100%'}}> | |
<Nav/> | |
<DropdownAlert ref={(ref) => DropDownHolder.setDropDown(ref)}/> | |
</View> | |
) | |
} | |
} | |
// ... | |
export class DropDownHolder { | |
static dropDown; | |
static setDropDown(dropDown) { | |
this.dropDown = dropDown; | |
} | |
static getDropDown() { | |
return this.dropDown; | |
} | |
} |
be sure to create separate component that contain DropDownHolder to write clean code
should we have a connect()(Screen) like linker for screens also, like redux
is there a way to close actively open alert when another one is requested to show?
I am trying to see how this would play out with a lot of incoming alerts. I think on iOS the main notifications alert shows for a min amount of time then quickly closes to show the next one that's queued up.. Currently , the DropdownAlert here has to allow the interval to pass before showing the next one..
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage :
DropDownHolder.dropDown.alertWithType('error', 'Error', 'Error message');