react-native#Clipboard JavaScript Examples

The following examples show how to use react-native#Clipboard. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClipboardModal.js    From RRWallet with MIT License 6 votes vote down vote up
async confirm() {
    let length = this.state.recipientList.length;
    if (length) {
      this.props.onDataParseSuccess && this.props.onDataParseSuccess(this.state.recipientList);
    } else {
      let text = await Clipboard.getString();
      this.setState({
        defaultValue: text,
      });
      this.textChange(text);
    }
  }
Example #2
Source File: Wallet.js    From web3-react-native with MIT License 6 votes vote down vote up
onRequestAddFunds = (e, wallet) => (dispatch, getState) => Promise
  .resolve()
  .then(
    () => {
      const { address } = wallet;
      if (typeCheck("String", address)) {
        Clipboard.setString(address);
        return Linking.openURL('https://faucet.ropsten.be/');
      }
      return Promise.reject(new Error(`Expected String address, encountered ${address}.`));
    },
  )
Example #3
Source File: SharedComponents.js    From hugin-mobile with GNU Affero General Public License v3.0 6 votes vote down vote up
render() {
      const { t } = this.props;
        return(
            <View style={[{...this.props.style}, {
                marginTop: 10,
                alignItems: 'flex-start',
                borderRadius: 3,
                borderColor: this.props.screenProps.theme.borderColour,
                borderWidth: 1,
                paddingTop: 0
            }]}>
                <Button
                    title={t('copy')}
                    onPress={() => {
                        Clipboard.setString(this.props.data);
                        toastPopUp(this.props.name + t('copied'));
                    }}
                    titleStyle={{
                        color: this.props.screenProps.theme.primaryColour,
                        textDecorationLine: 'none',
                        marginTop: -3
                    }}
                    type='clear'
                />
            </View>
        );
    }
Example #4
Source File: AboutScreen.js    From RRWallet with MIT License 5 votes vote down vote up
copy(data) {
    Clipboard.setString(data);
    this.hud.showSuccess(i18n.t("common-copy-success"));
  }
Example #5
Source File: MainScreen.js    From hugin-mobile with GNU Affero General Public License v3.0 4 votes vote down vote up
render() {
      const { t } = this.props;

        return(
            <View style={{ alignItems: 'center' }}>

                <View style={{ borderRadius: 15, borderWidth: 0, borderColor: this.props.screenProps.theme.borderColour, padding: 3, backgroundColor: 'rgba(0,0,0,0.2)' }}>
                <Image
                  style={{width: 112, height: 112}}
                  source={{uri: get_avatar(this.state.address, 112)}}
                />

                <CopyButton
                    style={{position: "absolute", top: 25, right: 20}}
                    data={this.state.address + Buffer.from(getKeyPair().publicKey).toString('hex')}
                    name='Address'
                    {...this.props}
                />
                <Text style={[Styles.centeredText, {
                    color: this.props.screenProps.theme.primaryColour,
                    textAlign: 'left',
                    fontSize: 10,
                    marginTop: 0,
                    marginRight: 20,
                    marginLeft: 20,
                    fontFamily: 'Montserrat-Bold'
                }]}>
                Nickname
                </Text>
                <View
                style={{
                    // width: this.state.messageHasLength ? '80%' : '100%',
                      backgroundColor: 'rgba(0,0,0,0.2)',
                      borderWidth: 0,
                      borderColor: 'transparent',
                      borderRadius: 15,
                      height: 50,
                      margin: '5%',
                      marginTop: 0
                  }}
                >
                <TextInput
                    multiline={false}
                    textAlignVertical={'top'}
                    ref={input => { this.input = input }}
                    style={{
                        color: this.props.screenProps.theme.primaryColour,
                        fontFamily: 'Montserrat-Regular',
                        fontSize: 15,
                        width: '100%',
                        height: '100%',
                        padding: 15,

                    }}
                    maxLength={24}
                    placeholder={Globals.preferences.nickname}
                    placeholderTextColor={'#ffffff'}
                    onSubmitEditing={async (e) => {
                      savePreferencesToDatabase(Globals.preferences);
                        // return;
                        // submitMessage(this.state.message);
                        // this.setState({message: '', messageHasLength: false});
                    }}
                    onChangeText={(text) => {
                        if (this.props.onChange) {
                            this.props.onChange(text);
                        }
                        Globals.preferences.nickname = text;
                    }}
                    errorMessage={this.props.error}
                />
                </View>
                <Text style={[Styles.centeredText, {
                    color: this.props.screenProps.theme.primaryColour,
                    textAlign: 'left',
                    fontSize: 10,
                    marginTop: 0,
                    marginRight: 20,
                    marginLeft: 20,
                    fontFamily: 'Montserrat-Bold'
                }]}>
                {t('paymentAddress')}
                </Text>
                  <Text numberOfLines={2} style={[Styles.centeredText, {
                      color: this.props.screenProps.theme.primaryColour,
                      width: 215,
                      fontSize: 15,
                      marginTop: 0,
                      marginRight: 20,
                      marginLeft: 20,
                      fontFamily: 'Montserrat-Regular'
                  }]} onPress={() => {
                      Clipboard.setString(this.state.address);
                      toastPopUp(this.state.address + t('copied'));
                      }
                  }
                >
                        {this.state.address}
                  </Text>

                  <Text style={[Styles.centeredText, {
                      color: this.props.screenProps.theme.primaryColour,
                      textAlign: 'left',
                      fontSize: 10,
                      marginTop: 10,
                      marginRight: 20,
                      marginLeft: 20,
                      fontFamily: 'Montserrat-Bold'
                  }]}>
                   {t('messageKey')}
                  </Text>

                  <Text onPress={() => {
                      Clipboard.setString(Buffer.from(getKeyPair().publicKey).toString('hex'));
                      toastPopUp(Buffer.from(getKeyPair().publicKey).toString('hex') + t('copied'));
                      }
                  } numberOfLines={2} style={[Styles.centeredText, {
                      color: this.props.screenProps.theme.primaryColour,
                      width: 215,
                      fontSize: 15,
                      marginTop: 0,
                      marginBottom: 5,
                      marginRight: 20,
                      marginLeft: 20,
                      fontFamily: 'Montserrat-Regular'
                  }]}>
                        {Buffer.from(getKeyPair().publicKey).toString('hex')}
                  </Text>


                </View>





            </View>
        );
    }
Example #6
Source File: TransferScreen.js    From hugin-mobile with GNU Affero General Public License v3.0 4 votes vote down vote up
render() {
        const { t } = this.props;
        const sending =
            <View>
                <Animatable.Text
                    style={{
                        color: this.props.screenProps.theme.primaryColour,
                        fontSize: 25,
                    }}
                    animation='pulse'
                    iterationCount='infinite'
                >
                    {t('sendingMsg')}
                </Animatable.Text>
            </View>;

        const fail =
            <View>
                <Animatable.Text
                    style={{
                        color: 'red',
                        fontSize: 25,
                        marginBottom: 25,
                        fontWeight: 'bold',
                    }}
                    animation='shake'
                    delay={1000}
                >
                    {t('failedMsg')}
                </Animatable.Text>

                <Text style={{ fontSize: 13 }}>
                    {this.state.errMsg}
                </Text>
            </View>;

        const success =
            <View>
                <Animatable.Text style={{
                        color: this.props.screenProps.theme.primaryColour,
                        fontSize: 25,
                        marginBottom: 25,
                        fontFamily: "Montserrat-SemiBold",
                    }}
                    animation='tada'
                    delay={1000}
                >
                    {t('completeMsg')}
                </Animatable.Text>

                <Text style={{ fontFamily: 'Montserrat-Regular', fontSize: 13, color: this.props.screenProps.theme.slightlyMoreVisibleColour }}>
                    <Text style={{ fontFamily: 'Montserrat-Regular',color: this.props.screenProps.theme.primaryColour }}>
                        {prettyPrintAmount(this.state.amount, Config)}{' '}
                    </Text>
                    was sent to{' '}
                    <Text style={{ fontFamily: 'Montserrat-Regular', color: this.props.screenProps.theme.primaryColour }}>
                        {this.state.nickname}'s{' '}
                    </Text>
                    account.
                </Text>

                <Text style={{ fontSize: 15, color: this.props.screenProps.theme.primaryColour, fontFamily: 'Montserrat-Regular', marginTop: 15 }}>
                    {t('transactionHash')}
                </Text>

                <TextTicker
                    marqueeDelay={1000}
                    duration={220 * 64}
                    style={{
                        color: this.props.screenProps.theme.slightlyMoreVisibleColour,
                    }}
                >
                    {this.state.hash}
                </TextTicker>

                <Button
                    containerStyle={{
                        alignItems: 'flex-start',
                        justifyContent: 'flex-start',
                        marginLeft: -8
                    }}
                    title={t('copy')}
                    onPress={() => {
                        Clipboard.setString(this.state.hash);
                        toastPopUp(t('copied'));
                    }}
                    titleStyle={{
                        color: this.props.screenProps.theme.primaryColour,
                        fontSize: 13
                    }}
                    type="clear"
                />

            </View>;

        return(
            <View style={{ flex: 1, backgroundColor: this.props.screenProps.theme.backgroundColour }}>
                <View style={{
                    flex: 1,
                    alignItems: 'flex-start',
                    justifyContent: 'flex-start',
                    marginTop: 60,
                    marginHorizontal: 30,
                }}>
                    {this.state.sent ? success : this.state.errMsg === '' ? sending : fail}
                </View>

                <BottomButton
                    title="Home"
                    onPress={() => {
                        this.props.navigation.dispatch(navigateWithDisabledBack('ChoosePayee'));
                        this.props.navigation.navigate('Main');
                    }}
                    disabled={!this.state.homeEnabled}
                    {...this.props}
                />
            </View>
        );
    }