NativeModules are empty
See original GitHub issueDescription
When creating new native library for application, when library is attached to the react native mobile application in iOS, the NativeModules are empty ({})
React Native version:
System: OS: macOS 10.15.5 CPU: (6) x64 Intel® Core™ i5-8500B CPU @ 3.00GHz Memory: 30.54 MB / 8.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.14.1 - /usr/local/bin/node Yarn: 1.21.1 - /usr/local/bin/yarn npm: 6.14.2 - /usr/local/bin/npm SDKs: iOS SDK: Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3 IDEs: Android Studio: 3.6 AI-192.7142.36.36.6308749 Xcode: 10.3/10G8 - /usr/bin/xcodebuild npmPackages: react: 16.11.0 => 16.11.0 react-native: 0.62.2 => 0.62.2 npmGlobalPackages: create-react-native-app: 3.4.0 react-native-create-library: 3.1.2 react-native: 0.61.4
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
- Create new RN application using
create-react-native-app my-project - Create new native library using
react-native-create-library -—platforms ios,android my-library - Configure XCode .xcworkspace project, link React library to the project, to let project see React binaries.
- In my-project app add
import { Button, NativeModules } from 'react-native';
const App: () => React$Node = () => {
return (
<>
<StatusBar barStyle="dark-content" />
<SafeAreaView>
<Button title="Press" onPress={() => onPress()}></Button>
</SafeAreaView>
</>
);
function onPress() {
console.log(NativeModules);
}
};
Expected Results
It doesn’t matter if it’s XCode 11 or XCode 10, the NativeModules is empty. When printing NativeModules.MyLibrary it’s null.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:6
Top Related StackOverflow Question
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community’s attention? This issue may be closed if no further activity occurs. You may also label this issue as a “Discussion” or add it to the “Backlog” and I will leave it open. Thank you for your contributions.
i have same issue nativeModule returns null for both android and ios