This example shows how to reuse code between different platforms when using React & React Native. It is based on the fact that React Native will detect when a file has a .ios. or .android. extension and load the relevant platform file when required from other components (see Platform-specific extensions).
- Install npm
- From the root directory of the repository execute
npm i
From the root directory of the repository execute gulp serve
Execute react-native run-ios
or open ios/ReactNativeCodeReuse.xcodeproj
with XCode and run the project.