I take a reference from official doc, it is working.
https://reactnative.dev/docs/turbo-native-modules-introduction?platforms=ios
However when I attempt to set a number of specs for iOS, I get the error
10 duplicate symbols
Linker command failed with exit code 1 (use -v to see invocation)
Here’s what I attempt:
step 1 npx @react-native-community/cli@newest init FirstApp
"react-native": "0.77.0",
step 2 add codegen setting in bundle.json
"codegenConfig": {
"libraries": [
{
"name": "NativeLocalStorageSpec",
"type": "modules",
"jsSrcsDir": "specs",
"android": {
"javaPackageName": "com.nativelocalstorage"
}
},
{
"name": "NativeBluetoothSpec",
"type": "modules",
"jsSrcsDir": "specs",
"android": {
"javaPackageName": "com.nativebluetooth"
}
}
]
},
step 3 add file underneath specs folder (RN root challenge)
specs/NativeBluetooth.ts
import sort { TurboModule } from 'react-native';
import { TurboModuleRegistry } from 'react-native';
export interface Spec extends TurboModule {
enableBluetooth(): void;
}
export default TurboModuleRegistry.getEnforcing('NativeBluetooth');
specs/NativeLocalStorage.ts
import sort {TurboModule} from 'react-native';
import {TurboModuleRegistry} from 'react-native';
export interface Spec extends TurboModule null;
removeItem(key: string): void;
clear(): void;
export default TurboModuleRegistry.getEnforcing('NativeLocalStorage');
step 4 sort terminal command
cd ios
bundle set up
bundle exec pod set up
after which open XCode construct the challenge get the error:
10 duplicate symbols
Linker command failed with exit code 1 (use -v to see invocation)
What’s the downside ?