diff --git a/packages/exampleReactNative/.gitignore b/packages/exampleReactNative/.gitignore deleted file mode 100755 index aadce1a1..00000000 --- a/packages/exampleReactNative/.gitignore +++ /dev/null @@ -1,64 +0,0 @@ -# OSX -# -.DS_Store - -# Xcode -# -build/ -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata -*.xccheckout -*.moved-aside -DerivedData -*.hmap -*.ipa -*.xcuserstate -project.xcworkspace - -# Android/IntelliJ -# -build/ -.idea -.gradle -local.properties -*.iml - -# Visual Studio Code -# -.vscode/ - -# node.js -# -node_modules/ -npm-debug.log -yarn-error.log - -# BUCK -buck-out/ -\.buckd/ -*.keystore -!debug.keystore - -# fastlane -# -# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the -# screenshots whenever they are needed. -# For more information about the recommended setup visit: -# https://docs.fastlane.tools/best-practices/source-control/ - -*/fastlane/report.xml -*/fastlane/Preview.html -*/fastlane/screenshots - -# Bundle artifact -*.jsbundle - -# CocoaPods -/ios/Pods/ diff --git a/packages/exampleReactNative/.skip-npm b/packages/exampleReactNative/.skip-npm deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/exampleReactNative/App.tsx b/packages/exampleReactNative/App.tsx deleted file mode 100644 index 0304f697..00000000 --- a/packages/exampleReactNative/App.tsx +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright 2017-2021 @polkadot/example-react authors & contributors -// SPDX-License-Identifier: Apache-2.0 - -import React, { useCallback, useEffect, useState } from 'react'; -import { Button, SafeAreaView, ScrollView, StatusBar, StyleSheet, Text, View } from 'react-native'; -import { Colors } from 'react-native/Libraries/NewAppScreen'; - -import Identicon from '@polkadot/reactnative-identicon'; -import { keyring } from '@polkadot/ui-keyring'; -import { settings } from '@polkadot/ui-settings'; -import { cryptoWaitReady, mnemonicGenerate } from '@polkadot/util-crypto'; - -const styles = StyleSheet.create({ - body: { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access - backgroundColor: Colors.white - }, - buttonContainer: { - alignItems: 'flex-start', - flex: 1, - flexDirection: 'column' - }, - mainTitle: { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access - color: Colors.black, - fontSize: 28, - fontWeight: '600' - }, - scrollView: { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access - backgroundColor: Colors.lighter - }, - sectionContainer: { - marginTop: 32, - paddingHorizontal: 24 - }, - sectionDescription: { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access - color: Colors.dark, - fontSize: 18, - fontWeight: '400', - marginTop: 8 - }, - sectionTitle: { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access - color: Colors.black, - fontSize: 24, - fontWeight: '600' - } -}); - -const globalAny = global as unknown as Window; - -export default function App (): React.ReactElement | null { - const [isReady, setReady] = useState(false); - const [address, setAddress] = useState(null); - const [phrase, setPhrase] = useState(null); - const [ss58Format, setSS58Format] = useState(42); - - const _onClickNew = useCallback( - (): void => { - const phrase = mnemonicGenerate(12); - const { address } = keyring.createFromUri(phrase); - - setAddress(keyring.encodeAddress(address, ss58Format)); - setPhrase(phrase); - }, - [ss58Format] - ); - - const _onChangeSS58Format = useCallback( - (value: string) => - () => setSS58Format(parseInt(value, 10)), - [] - ); - - useEffect((): void => { - isReady && _onClickNew(); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [isReady]); - - useEffect((): void => { - isReady && address && setAddress(keyring.encodeAddress(address, ss58Format)); - }, [address, isReady, ss58Format]); - - const initialize = async (): Promise => { - try { - keyring.loadAll({ ss58Format: 42, type: 'sr25519' }); - } catch (e) { - console.log('Error loading keyring ', e); - } - - // eslint-disable-next-line @typescript-eslint/no-unsafe-call - await globalAny.localStorage.init(); - await cryptoWaitReady(); - - setReady(true); - _onClickNew(); - }; - - if (!isReady) { - // eslint-disable-next-line @typescript-eslint/no-floating-promises - initialize(); - } - - if (!isReady || !address || !phrase) { - return null; - } - - return ( - <> - - - - - - React-Native Example - - -