-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatible with react-native-router-flux #37
Comments
I didn't try but I guess it should be possible to make it compatible <GiftedForm
openModal={(route) => {
// the trick will be here
}}
/> The purpose of openModal prop is to navigate to the modal. The content of the modal is defined by the Maybe #1 can help you |
how if I just simply install both router? is it just working out of the box without crashing? |
It might work |
Thanks for the response, I'll try it @FaridSafi . |
@radiegtya Did you make this works with react-native-router-flux? |
I've managed to get it partially working. I struggled for a while attempting to get the renderRight/Left buttons returned from the ModalWidget working properly with router-flux. My eventual solution did require me to fork and make this small change (I could not get the displayValue to update properly, this is most likely not in line with the authors intent for navigator usage): https://github.com/deldreth/react-native-gifted-form/blob/master/widgets/ModalWidget.js#L143 The project that this is in reference to is still using react-native-router-flux @ 2.x. Outside of that... My modal component... I'm going for simplicity here import React, {
Component
} from 'react-native';
export default class FormModal extends Component {
constructor (props) {
super(props);
}
componentWillUnmount () {
this.props.updateDisplayValue();
}
render () {
return this.props.renderScene();
}
}
FormModal.propTypes = {
renderScene: React.PropTypes.func,
updateDisplayValue: React.PropTypes.func
}; My GiftedForm and openModal prop: <GiftedForm
openModal={route => {
Actions.formModal({ ...route, title: route.getTitle() });
}}>
</GiftedForm> My Route Configuration: <Route name='form' title='Installer Signup' component={Form}/>
<Route name='formModal' component={Modal}/> I could not reliably get right/left navigation bar rendering to work (it may be in relation to the older version of react-native-router-flux this project uses). |
@deldreth thank's to help, and I found navigation right button render on const btnItem = this.props.renderRightButton()
btnItem.props.onPress()
Actions.pop() |
ended up adding some styling to the |
@bsy could you say how you did it with react-native-router-flux 3.30? |
@ramneekhanda @sudugo and others... I know it's been several months, but I was able to get modals working using The React component for the modal (I leave the styling up to you) import React from 'react'
import { ScrollView } from 'react-native'
export default class FormModalScreen extends React.Component {
render () {
return (
<ScrollView>
{ this.props.renderScene() }
</ScrollView>
)
}
} The react-native-router-flux configuration import FormModal from '...'
<Router>
...
<Scene
key='formModal'
component={FormModal}
direction='vertical'
rightTitle='Save'
/>
...
</Router> The import { Actions } from 'react-native-router-flux'
<GiftedForm
openModal={(route) => {
Actions.formModal({
title: route.getTitle(),
renderScene: route.renderScene,
/*
Option 1: If you like the buttons react-native-gifted-form
gives you, then use this step:
*/
renderRightButton: route.renderRightButton.bind(route, Actions),
/*
Option 2: If you prefer your own right button (or text), then
use this step:
*/
// onRight: route.onClose.bind(null, null, Actions)
})
}}
/> The reason why you need to use the Anyways, hope this helps. (The screencast animation is a bit strange, but anyways it works) |
@henrythach works perfectly! |
Hello, someone help me with the following error I am using the following react-native-gifted-form library, for android. <GiftedForm.SelectCountryWidget |
Hello it give me this error when i click the modal
i hope some one help me |
Is this component Compatible with react-native-router-flux?
The text was updated successfully, but these errors were encountered: