zhangchao 4 лет назад
Родитель
Сommit
888a3a2c93
1 измененных файлов: 23 добавлений и 20 удалений
  1. 23
    20
      src/RichTextEditor.js

+ 23
- 20
src/RichTextEditor.js Просмотреть файл

@@ -148,7 +148,7 @@ export default class RichTextEditor extends Component {
148 148
           this.setContentHTML(this.props.initialContentHTML || '');
149 149
           !this.props.hiddenTitle && this.showTitle();
150 150
           this.props.enableOnChange && this.enableOnChange();
151
-          
151
+
152 152
           this.props.editorInitializedCallback && this.props.editorInitializedCallback();
153 153
 
154 154
           break;
@@ -221,15 +221,15 @@ export default class RichTextEditor extends Component {
221 221
               <Text style={[styles.inputTitle ,{marginTop: 10}]}>{linkOption.urlText}</Text>
222 222
               <View style={styles.inputWrapper}>
223 223
                 <TextInput
224
-                    style={styles.input}
225
-                    onChangeText={(text) => this.setState({linkUrl: text})}
226
-                    value={this.state.linkUrl}
227
-                    keyboardType="url"
228
-                    autoCapitalize="none"
229
-                    autoCorrect={false}
224
+                  style={styles.input}
225
+                  onChangeText={(text) => this.setState({linkUrl: text})}
226
+                  value={this.state.linkUrl}
227
+                  keyboardType="url"
228
+                  autoCapitalize="none"
229
+                  autoCorrect={false}
230 230
                 />
231 231
               </View>
232
-              {PlatformIOS && <View style={styles.lineSeparator}/>}
232
+              <View style={styles.lineSeparator}/>
233 233
               {this._renderModalButtons()}
234 234
             </View>
235 235
           </View>
@@ -248,12 +248,11 @@ export default class RichTextEditor extends Component {
248 248
 
249 249
   _renderModalButtons() {
250 250
     const insertUpdateDisabled = this.state.linkTitle.trim().length <= 0 || this.state.linkUrl.trim().length <= 0;
251
-    const containerPlatformStyle = PlatformIOS ? {justifyContent: 'space-between'} : {paddingTop: 15};
252
-    const buttonPlatformStyle = PlatformIOS ? {flex: 1, height: 45, justifyContent: 'center'} : {};
251
+    const containerPlatformStyle = {justifyContent: 'space-between'};
252
+    const buttonPlatformStyle = {flex: 1, height: 45, justifyContent: 'center'};
253 253
     const { linkOption } = this.props;
254 254
     return (
255
-      <View style={[{alignSelf: 'stretch', flexDirection: 'row'}, containerPlatformStyle]}>
256
-        {!PlatformIOS && <View style={{flex: 1}}/>}
255
+      <View style={{alignSelf: 'stretch', flexDirection: 'row', justifyContent: 'space-between'}}>
257 256
         <TouchableOpacity
258 257
             onPress={() => this._hideModal()}
259 258
             style={buttonPlatformStyle}
@@ -467,7 +466,7 @@ export default class RichTextEditor extends Component {
467 466
   deleteEmoji(url) {
468 467
     this._sendAction(actions.deleteEmoji, url);
469 468
   }
470
-  
469
+
471 470
   setSubscript() {
472 471
     this._sendAction(actions.setSubscript);
473 472
   }
@@ -614,7 +613,7 @@ export default class RichTextEditor extends Component {
614 613
   setOnChangeEmptyOrNot(callbackHandler) {
615 614
     this.onChangeEmptyOrNot = callbackHandler;
616 615
     this._sendAction(actions.setOnChangeEmptyOrNot);
617
-  }
616
+  } 
618 617
 
619 618
   addSelectedTextChangeListener(listener) {
620 619
     this._selectedTextChangeListeners.push(listener);
@@ -631,12 +630,12 @@ const styles = StyleSheet.create({
631 630
   innerModal: {
632 631
     backgroundColor: 'rgba(255, 255, 255, 0.9)',
633 632
     paddingTop: 20,
634
-    paddingBottom: PlatformIOS ? 0 : 20,
633
+    paddingBottom: 0,
635 634
     paddingLeft: 20,
636 635
     paddingRight: 20,
637 636
     alignSelf: 'stretch',
638 637
     margin: 40,
639
-    borderRadius: PlatformIOS ? 8 : 2
638
+    borderRadius: 8
640 639
   },
641 640
   button: {
642 641
     fontSize: 16,
@@ -647,20 +646,24 @@ const styles = StyleSheet.create({
647 646
     marginTop: 5,
648 647
     marginBottom: 10,
649 648
     borderBottomColor: '#4a4a4a',
650
-    borderBottomWidth: PlatformIOS ? 1 / PixelRatio.get() : 0
649
+    borderBottomWidth: StyleSheet.hairlineWidth,
650
+    justifyContent :'flex-end',
651
+    height: 30,
652
+    paddingBottom: 1,
651 653
   },
652 654
   inputTitle: {
653 655
     color: '#4a4a4a'
654 656
   },
655 657
   input: {
656
-    height: PlatformIOS ? 20 : 40,
657
-    paddingTop: 0
658
+    padding: 0,
659
+    margin: 0,
660
+    includeFontPadding:false,
658 661
   },
659 662
   lineSeparator: {
660 663
     height: 1 / PixelRatio.get(),
661 664
     backgroundColor: '#d5d5d5',
662 665
     marginLeft: -20,
663 666
     marginRight: -20,
664
-    marginTop: 20
667
+    marginTop: 15
665 668
   }
666 669
 });