react-native-mobx icon indicating copy to clipboard operation
react-native-mobx copied to clipboard

Let me know how to integrate with react-intl

Open justinFather opened this issue 8 years ago • 1 comments

What I tried as below

class App_ extends Component {
	render() {
                return (
	                <Router store={store}>
	                        <Scene key="root">
                                ...
	                        </Scene>
	                </Router>
	        )		
	}
}

@inject( 'store' ) @observer
class ForIntlProvider extends Component {
	render() {
		return (
			<IntlProvider locale={store.locale} messages={all[store.locale]}>
				<App_/>
			</IntlProvider>
		)
	}
}

export default class App extends Component {
	render() {
		return (
			<Provider store={store}>
				<ForIntlProvider/>
			</Provider>
		)
	}
}

But it was not successful. In order to use react-intl, App_ should be wrapped by IntlProvider which needs mobx store as well.

Now react-native-mobx just uses store props in Router component.

What shall I do?

justinFather avatar Feb 25 '17 05:02 justinFather

I created a small library that might help you https://github.com/Sqooba/mobx-react-intl/blob/master/README.md . The goal is to integrate mobx-react with react-intl. I didn't test it on react-native yet though.

ChrisJamesC avatar May 23 '17 05:05 ChrisJamesC