React native - 未显示特定长度的文本

问题描述 投票:1回答:1

我正在创建一个带有iOS segmentControl的页面,以在隐私政策和条款和条件之间切换。隐私政策(100行)显示正常,但条件(145行)根本不显示。

如果我删除4个(相同的)段,则文本会再次显示。是否有最大数量的线可以显示?

下面的conditions代码。

import React from 'react';
import { Text, StyleSheet } from 'react-native';

const styles = StyleSheet.create({
  underline: {
    textDecorationLine: 'underline',
  },
  bold: {
    fontWeight: 'bold',
  },
  defaultTextStyle: {
    fontFamily: 'Nunito-Regular',
    fontSize: 15,
    color: '#525252',
  }
});

const Condition = () => (
  <Text style={styles.defaultTextStyle}>
    The private company with limited liability <Text style={styles.bold}>COMPANY B.V.</Text>, having its registered seat and its place of business in the Netherlands (hereinafter: the “<Text style={styles.bold}>Licensor</Text>”) hereby grants the <Text style={styles.bold}>End User</Text> a license to use its COMPANY subject to the following terms and conditions:{'\n\n'} 

        <Text style={styles.bold}>Article 1: Definitions</Text> {'\n'}
        1.1 <Text style={styles.underline}>Additional Services</Text>: the additional Services to be provided to a specific End User based on a specific agreement between COMPANY and the End User. {'\n'}
        1.2 <Text style={styles.underline}>Equipment</Text>: the phone or other peripheral device on which the End User has installed COMPANY. {'\n'}
        1.3 <Text style={styles.underline}>Basic services</Text>: the Services that are available as standard for all COMPANY End Users. {'\n'}

        1.4 <Text style={styles.underline}>Third Parties</Text>: parties that perform Services and / or activities on COMPANY on basis of a further agreement with the Licensor for End User. {'\n'}
        1.5 <Text style={styles.underline}>Service</Text>: offering or processing current and other information, such as traffic information, in COMPANY by means of remote communication technologies. {'\n'}
        1.6 <Text style={styles.underline}>End User</Text>: the natural person who uses or wishes to use COMPANY. {'\n'}
        1.7 <Text style={styles.underline}>Intellectual Property Rights</Text>: all rights of intellectual property, including, without limitation, copyrights, database rights, trademarks, knowhow, patent rights. {'\n'}
        1.8 <Text style={styles.underline}>In-App Purchases</Text>: ordering Additional Services or making any purchases or other purchases through COMPANY, which order is or can be processed through the Store. {'\n'}
        1.9 <Text style={styles.underline}>COMPANY</Text>: the software, including all COMPANY Updates, developed by the Licensor. {'\n'}
        1.10 <Text style={styles.underline}>License</Text>: the right granted to the End User by the Licensor to install, load, run and use COMPANY on the Equipment, in accordance with the terms and conditions of this License Agreement. {'\n'}
        1.11 <Text style={styles.underline}>License Agreement</Text>: the present agreement. {'\n'}
        1.12 <Text style={styles.underline}>Support</Text>: support provided to End Users, consisting of answering questions relating to the use and the functionality of COMPANY. {'\n'}
        1.13 <Text style={styles.underline}>Store</Text>: the online platforms operated by third parties, enabling COMPANY to be downloaded and purchases to be made and/or In-App purchases to be handled and processed, which platforms at least include the iTunes App Store, Google Play and the Windows Phone Store. {'\n'}
        1.14 <Text style={styles.underline}>User-generated Content</Text>: any works and data generated by the End User which have been sent to the Licensor through COMPANY or otherwise. {'\n'}
        1.15 <Text style={styles.underline}>Update</Text>: an improved version of COMPANY in which any errors have been rectified (e.g. from version 0.1 to version 0.2) or which contains a change in functionality or new functions (e.g. from version 1.0 to version 2.0). {'\n\n'}

    <Text style={styles.bold}>Article 2: License and license conditions</Text>
    {`\n
        2.1 COMPANY hereby grants the End User a non-exclusive and non-transferable License to use COMPANY in accordance with the terms and conditions stated in this License Agreement. \n
        2.2 The License for COMPANY can only be obtained through the Store. The term of this License is equal to the term indicated in the Store at the time of purchasing the License; if no such term is indicated, the term of validity of the License will be one year. \n
        2.3 If there are any disputes as to the term of validity of the License, the Licensor&apos;s and/or the Store&apos;s records will be binding in principle, subject to evidence to the contrary by the End User. \n
        2.4 If the License for COMPANY is not renewed at the end of the term, this License will automatically expire. \n
        2.5 The End User hereby explicitly consents to the manner of dissolution as offered in the Store from which the End User places COMPANY on the Equipment. Should such offer in the Store imply a restriction of the statutory cancellation period, the End User hereby already waives their right to dissolve the purchase agreement during the statutory cancellation period. \n
        2.6 The End User shall not be allowed to distribute, sell, copy or transfer COMPANY or to lose control of COMPANY in any other manner. The End User shall not be allowed to provide their COMPANY account details, and specifically not their password, to third parties. \n
        2.7 The End User shall not be allowed to make any changes to COMPANY or any of its parts. Furthermore, the End User shall not be allowed to reverse engineer or decompile COMPANY or any of its elements, other than for such situations where this is allowed pursuant to copyright subject to mandatory provisions of law and on condition that the End User has been given prior written permission from the Licensor in this regard. The Licensor shall be allowed to attach conditions to such permission.\n\n
    `}
    <Text style={styles.bold}>Article 3: Service provision</Text>
    {`\n
        3.1 The Licensor grants the Basic service and any Additional Services to the End User for the term of this License Agreement.
        3.2 Additional Services may be offered by Licensor or Third Parties. Licensor does not guarantee the availability of Services from Third Parties. The general terms and conditions of Third Parties apply to the use of Services of Third Parties.\n
        3.3 Licensor will actively attempt to achieve the greatest possible availability of the Services. However, Licensor cannot guarantee that the Services will be continually available. \n
        3.4 Furthermore, COMPANY will actively attempt to make sure that the information offered by means of the Services is correct, and that the relevant service provision is carried out correctly. However, COMPANY cannot guarantee that all information offered and/or services provided are free of errors, suitable for a certain purpose or suitable for regular use. \n
        3.5 The End User can purchase Additional Services from COMPANY, both through In-App Purchases and by means of the Store. Any specific terms and conditions as may be stated when the purchase in question is made shall apply to the use of Additional Services. The price and the duration of the Additional Services will be laid down in the relevant agreement.\n
        3.6 The End User hereby requests that the performance of the Additional Services is started immediately upon payment being made in the Store – i.e. during the statutory cancellation period. The End User shall accept the terms of dissolution offered in the Store.\n
        3.7 The End User can make suggestions to the Licensor for various Services as to adding, improving or removing certain information. The Licensor will consider such User-Generated Content, but shall not be under any obligation to comply with all such suggestions.\n\n
    `}

    <Text style={styles.bold}>Article 4: Price and Payment</Text>
    {`\n
        4.1 The End User shall pay the charge for the License for COMPANY as stated in the Store. \n
        4.2 The End User shall pay the charge for the Additional Services as stated in the agreement in question. \n
        4.3 Payment of the charges for the License for COMPANY and/or the Additional Services shall only be made through the Store. \n
    `}
    <Text style={styles.bold}>Article 5: Maintenance and Updates</Text> 
    {`\n
        5.1 The Licensor will maintain only the latest, i.e. current, version of COMPANY to the best of its abilities and will do its utmost to repair any errors and provide Updates. \n
        5.2 Furthermore, COMPANY can develop COMPANY Updates if COMPANY deems this appropriate and desirable. \n
        5.3 Updates shall be distributed solely through the Store and the technologies provided for this purpose by the providers of the Store. \n
        5.4 The End User shall not be under any obligation, but is explicitly recommended, to install all Updates or have them installed. The Licensor explicitly states that the Services may work only with the latest, i.e. current, version of COMPANY. This means that any failure to install Updates may lead to a loss of some, or the absence of all, functionality in COMPANY \n\n
    `}

    <Text style={styles.bold}>Article 6:  Support</Text>
    {`\n
        6.1 The Licensor shall offer Support free of charge to the End User. \n
        6.2 Such Support is only offered for the latest version of COMPANY. \n
        6.3 Although the Licensor will do its utmost to solve any issues, Support is offered “as is” and without any guarantees. The Licensor cannot guarantee that any responses given will be correct. \n
        6.4 Support is solely offered through the Licensor&apos;s website and through any social media channels designated by the Licensor. The End User can ask the Licensor questions through the website and/or social media and/or contact other users of COMPANY via the forum. \n
        6.5 Licensor does not offer Support for Third Parties Services. \n
        6.6 Given the ‘free-of-charge’ character of Support, the Licensor has the right to stop providing Support to End Users who ask for Support on an excessive basis. \n\n
    `}

    <Text style={styles.bold}>Article 7: Intellectual property and indemnification</Text>
    {`\n
        7.1 Any and all Intellectual Property Rights in COMPANY, the User-Generated Content and the other works shall vest exclusively in COMPANY, its licensors or its suppliers. The End User will only obtain such rights of use as explicitly stipulated in this License Agreement, and subject to the Terms and Conditions of this License Agreement. \n
        7.2 The End User hereby irrevocably transfers any and all Intellectual Property Rights in the User-Generated Content – to the extent that such rights exist – to the Licensor. Such transfer shall include all current and future rights of the End User, which shall include - without limitation - the publishing, multiplying, requesting, retrieving and reusing the User-Generated Content for the purpose of the current and future operation of COMPANY and the Service. Furthermore, to the extent legally allowed, the End User shall waive all moral rights (&apos;persoonlijkheidsrechten&apos;) as referred to in section 25 of the Dutch Copyright Act (Auteurswet). Should however it not be possible to fully or partially effectuate the transfer and waiver of rights as referred to in the previous paragraph, the End User hereby additionally grants an irrevocable license, free of charge, to the Licensor to use the User-Generated Content for the purposes referred to above for an indefinite period of time, as if the Intellectual Property Rights in the User-Generated Content belonged to the Licensor and without the Licensor having to state the End User&apos;s name or respect any other moral rights of the End User. \n'}
        7.3 The End User shall not be allowed to remove or modify any indications of copyrights, brands, tradenames or of any other rights of intellectual or industrial property. \n
        7.4 The Licensor shall be allowed to take technical measures to protect COMPANY and the Services or technical measures in respect of the agreed usage and/or any other restrictions as regards the License. The End User shall not be allowed to remove, evade or bypass such technical measures. \n
        7.5 The Licensor shall indemnify and hold the End User harmless against third-party claims based on the allegation that COMPANY, the Service, or any other materials that come from the Licensor infringe third-party Intellectual Property Rights, on condition that the End User shall immediately inform the Licensor about the existence and content of any such claims and shall fully leave the handling of such claims - which shall include, without limitation, any settlements - to the Licensor. The End User shall fully cooperate with the Licensor in this respect as required. \n
        7.6 If there are serious suspicions that COMPANY or any other materials provided to the End User by the Licensor infringe on any third-party Intellectual Property Right, the Licensor - at its exclusive discretion – will (a) change COMPANY / the Service so that such third-party Intellectual Property Rights are no longer infringed, (b) offer the End User comparable software/services with comparable functionality that does/do not infringe such third-party rights, (c) obtain a license from such third parties at its own cost with the objective that the End User will be able to continue to use COMPANY and/or the Services, (d) or offer any other reasonable solution to the End User. Any other or further liability on the part of COMPANY for violation of a third-party&apos;s Intellectual Property Rights shall be fully excluded. \n\n
    `}

    <Text style={styles.bold}>Article 8: Liability</Text>{`\n
        8.1 Without prejudice to the other provisions on Licensor’s liability, Licensor’s total liability for an attributable shortcoming in performing the agreement will be limited to it compensating direct damage or loss up to a maximum amount of €500 (five houndred euros). Direct damage or loss shall only be: \n
        a.) any reasonable costs that would be incurred by the End User in order to have COMPANY&apos;s performance comply with the License Agreement - however, such substitute damages will not be compensated if the agreement is dissolved by, or as demanded by, the End User; \n
        b.) any reasonable costs incurred to determine the cause and extent of the damage or loss, to the extent that such determination concerns direct damage or loss within the meaning of these terms and conditions; \n
        c.) any reasonable costs incurred to prevent or restrict damage or loss, to the extent that the End User demonstrates that such costs resulted in direct damage or loss within the meaning of these terms and conditions being contained. \n
        8.2 All liability on the part of Licensor for consequential damage or loss, lost profit, lost savings, any decrease in the value of goodwill, damage or loss due to business interruption, damage or loss due to claims of the End User&apos;s customers, data being damaged or lost and all forms of damage or loss other than those referred to in article 8.1, shall be excluded. \n
        8.3 Licensor’s liability for any attributable shortcoming in the performance of its obligations from this License Agreement shall always only arise if the End User immediately sends Licensor a proper notice of default, stating a reasonable time to as yet remedy the shortcoming, and if Licensor still fails to properly perform its obligations after such time has elapsed. The notice of default shall contain an accurate description of the shortcoming, in as much detail as possible, enabling COMPANY to react in an adequate manner. \n
        8.4 Licensor is in not liable for any damage caused by Third Party Services. {'\n\n'}
    `}

    <Text style={styles.bold}>Article 9: Guarantee</Text>
    {`\n
        9.1 COMPANY, including any Updates, as well as the associated Services, shall be provided to the End User “as is”. The Licensor does not guarantee that COMPANY, nor the Services, will function without any interruption, be free from errors or be suitable for any specific purpose, or that the information offered will be complete, or that errors or other problems will be remedied in Updates and/or modifications of the Service. \n
        9.2 The Licensor emphasises that any use of COMPANY and the Service(s) by the End User will be at the End User&apos;s own responsibility. More specifically, the Licensor would like to remind the End User of the following in this context: \n
        a.) that COMPANY and the Service are not intended to be used in order to bypass or evade compliance with traffic or other legislation and regulations; \n
        b.) that the Equipment should not be operated by the driver while driving; \n
        c.) that the use of COMPANY and the Service may not be allowed in some countries / jurisdictions. \n\n
    `}

    <Text style={styles.bold}>Article 10: Privacy and the processing of personal details</Text>
    {`\n
        10.1 The use of COMPANY and the Service(s) involves personal details (including location details) being processed. The Licensor is the party responsible for such processing of details. \n
        10.2 The use of COMPANY also involves that data is temporarily or permanently stored on and read from the End User&apos;s Equipment. \n
        10.3 By using COMPANY and the Service(s), the End User gives the Licensor permission for such processing of personal details and other data. \n
        10.4 The purposes of such processing, and other information regarding such processing of personal details or other data, can be found in Licensor’s privacy statement [add hyperlink]. \n
        10.5 The Licensor reserves the right to change the privacy statement from time to time. The latest version of the privacy statement can always be found on the Licensor&apos;s website. The End User hereby agrees to such -minor- changes, on the understanding that, if obliged by law, the Licensor shall ask the End User&apos;s permission or supplementary permission before processing the End User&apos;s personal details in accordance with a new privacy statement.\n\n
    `}

    <Text style={styles.bold}>Article 11: Term, termination and the consequences of termination</Text>
    {`\n
        11.1 This License Agreement is entered into for the duration of the License and/or the Services. \n
        11.2 Licensor can terminate this License Agreement in writing with immediate effect and block the End User’s access to the Service: \n
        a.) if the End User fails to comply with its obligations from this License Agreement; \n
        b.) if the End User submits User-Generated Content that is incorrect or that is contrary to the law, public order or good morals on a more than incidental basis; \n
        c.) if the End User publicly advertises COMPANY and/or the Service as a means of circumventing compliance with traffic or other legislation or of circumventing checks of such compliance with legislation; \n
        d.) if the Licensor finds that operating COMPANY is no longer cost-effective due to changes to legislation, e.g. legislation that prohibits using the service provided by COMPANY to consumers. \n
        11.3 If this License Agreement is terminated for any ground or reason, all rights that have been granted to the End User pursuant to this License Agreement shall automatically lose effect and the End User shall be obliged to destroy COMPANY or remove it from its Equipment. All payment obligations of the - then former - End User shall continue to exist and shall be due and payable. \n\n
    `}
    <Text style={styles.bold}>Article 12: Other provisions</Text>
    {`\n
        12.1 If a competent judicial body or a competent administrative body finds that a provision of the License Agreement is null and void or unenforceable, this will not affect the other provisions of this License Agreement and all such provisions not affected shall remain in full force and effect. \n
        12.2 The Parties shall attempt to substitute any null and void or unenforceable provision by a valid and enforceable alternative which achieves, to the greatest extent possible, the economic, legal and commercial objectives of the null and void or unenforceable provision.  \n
        12.3 This License Agreement is the entire agreement between the parties. Any additions or changes to this License Agreement shall only be binding if agreed in writing. \n
        12.4 The End User shall not transfer or otherwise hand over its obligations from this License Agreement, without the Licensor&apos;s prior written permission. \n
        12.5 If the Licensor transfers its company to a third party, it shall be entitled to then also transfer its rights and obligations from this License Agreement to such third party. Furthermore, the Licensor shall be entitled to transfer its rights and obligations from this License Agreement to any third party on any other grounds, but in this latter event the Licensor shall be liable in respect of the End User for such third party performing the obligations. The End User hereby accepts such transfer by the Licensor and undertakes to cooperate with it as required.\n\n
    `}

    <Text style={styles.bold}>Article 13:  Applicable law and competent court</Text>
    {`\n
    13.1 This agreement shall exclusively be governed by Dutch law. The &quot;United Nations Convention on Contracts for the International Sale of Goods&quot; of 1980 shall not apply. \n
    13.2 Any and all disputes resulting from or in connection with this License Agreement or any further agreements in connection with this License Agreement shall exclusively be adjudicated by the competent court in the country where the End User is domiciled as the court of first instance.\n
    `}
  </Text>
)

export default Condition;

条款和条件如下。条件正在{this.renderDocument(this.state.switchItemSelected)}呈现

import React from 'react';
import {
  View,
  ScrollView,
  Text,
  TouchableOpacity,
  StyleSheet,
  AsyncStorage,
  Alert,
  StatusBar,
  Switch,
} from 'react-native';
import PropTypes from 'prop-types';
import LinearGradient from 'react-native-linear-gradient';

import { t } from '../../i18n/i18n';
import {
  FacebookUserAccessTokenKey,
  UserAccessTokenKey,
  UserIdKey,
  UserNameKey,
  LoggedInKey,
} from '../../utils/Globals';

import NavigatorUtil from '../../utils/Navigator';
import AuthService from '../../utils/services/AuthService';
import pushNotificationService from '../../utils/services/PushNotificationService';

import PrivacyPolicy from './PrivacyPolicy';
import Conditions from './Conditions';

const styles = StyleSheet.create({
  wrapper: {
    backgroundColor: 'white',
    height: '100%',
  },
  scrollView: {
    flex: 1,
    margin: 15,
  },
  agreeButton: {
    width: 343,
    height: 56,
    alignItems: 'center',
    margin: 16,
  },
  gradient: {
    width: 343,
    height: 56,
    alignItems: 'center',
    justifyContent: 'center',
    borderRadius: 13,
  },
  disabledGradient: {
    width: 343,
    height: 56,
    alignItems: 'center',
    justifyContent: 'center',
    borderRadius: 13,
  },
  buttonText: {
    fontSize: 18,
    color: 'white',
    fontFamily: 'Nunito-Bold',
  },
  disabledButtonText: {
    fontSize: 18,
    color: 'rgba(0,0,0,0.2)',
    fontFamily: 'Nunito-Bold',
  },
  agreeSwitch: {
    transform: [{ scaleX: 1.2 }, { scaleY: 1.2 }],
  },
  switchContainer: {
    flexDirection: 'row',
    alignItems: 'center',
    justifyContent: 'space-between',
    marginLeft: 16,
    marginRight: 16,
  },
  textContainer: {
    marginLeft: 16,
    marginRight: 16,
    marginBottom: 15,
  },
  bold: {
    fontWeight: 'bold',
    color: "#585858",
    fontFamily: 'Nunito-Bold',
  },
  defaultTextStyle: {
    fontFamily: 'Nunito-Regular',
    fontSize: 15,
    color: 'rgba(82,82,82,0.75)',
  },
});

export default class TermsAndConditions extends React.Component {
  constructor() {
    super();

    this.state = {
      switchItemSelected: 'Privacy Policy',
      userPolicyAgree: false,
    };
  }

  componentDidMount() {
    this.props.navigation.setParams({ switchChanged: this.onSwitchChanged });
  }

  onSwitchChanged = selectedItem => {
    this.setState({ switchItemSelected: selectedItem });
  };

  persistUserInfo = userInfo => {
    AsyncStorage.setItem(UserAccessTokenKey, userInfo.accessToken);
    AsyncStorage.setItem(UserIdKey, userInfo.id);
    AsyncStorage.setItem(UserNameKey, userInfo.name);
    AsyncStorage.setItem(LoggedInKey, 'true');
  };

  close = () => {
    Navigator.navigate('Onboarding');
  };

  agreePressed = async () => {
    const accessToken = await AsyncStorage.getItem(FacebookUserAccessTokenKey);
    const {
      deviceToken,
      deviceType,
    } = pushNotificationService.getDeviceRegistration();

    AuthService.fetchUserInfo({
      deviceType,
      deviceToken,
      facebookAccessToken: accessToken,
    })
      .then(userInfo => this.persistUserInfo(userInfo))
      .then(() => NavigatorUtil.navigate('Home'))
      .catch(error => Alert.alert(error.message));
  };

  renderDocument = selectedItem => {
    if (selectedItem === 'Privacy Policy') return <PrivacyPolicy />;
    return <Conditions />;
  };

  render() {
    return (
      <View style={styles.wrapper}>
        <StatusBar barStyle="light-content" />
        <ScrollView>
          <View style={{padding: 15}}>
            {this.renderDocument(this.state.switchItemSelected)}
          </View>
        </ScrollView>
    <View style={{borderTopWidth: 1, borderTopColor: "rgba(211,211,211,0.5)", paddingTop: 15}}>
        <View style={styles.textContainer}>
            <Text style={styles.bold}>Accept the terms and privacy policy</Text>
            <Text style={styles.defaultTextStyle}>I have read the privacy policy and terms of service and agree</Text>
      </View>
        <View style={styles.switchContainer}>
            <Text style={styles.bold}>I agree</Text>
            <Switch
              style={styles.agreeSwitch}
              value={this.state.userPolicyAgree}
              onValueChange={newValue =>
                this.setState({ userPolicyAgree: newValue })
              }
              onTintColor="#F0813F"
              thumbTintColor="#FFFFFF"
            />
        </View>
          <TouchableOpacity
                style={styles.agreeButton}
                onPress={() => this.agreePressed()}
                disabled={!this.state.userPolicyAgree}
          >

            <LinearGradient
              colors={this.state.userPolicyAgree ? ['#F0A83F', '#F07B3F'] : ['#DCDCDC', '#DCDCDC'] }
              style={styles.gradient}
            >
              <Text style={this.state.userPolicyAgree ? styles.buttonText : styles.disabledButtonText}>
                {t('onboarding:termsAndConditionsAgreementText')}
              </Text>
            </LinearGradient>
          </TouchableOpacity>
        </View>
      </View>
    );
  }
}

TermsAndConditions.propTypes = {
  navigation: PropTypes.shape().isRequired,
};
reactjs react-native
1个回答
1
投票
import {ScrollView} from 'react-native';

然后在编码代码中移动ScrollView中的所有标记,如下所示,希望它有所帮助

<ScrollView>ALL YOUR TEXT TAGS HERE</ScrollView>
© www.soinside.com 2019 - 2024. All rights reserved.