From fc2d037635ff2062c5a3d0ed65ac44c84eb6d487 Mon Sep 17 00:00:00 2001 From: Fodor Bence Date: Thu, 23 Jan 2020 12:14:31 +0100 Subject: [PATCH 1/2] fix rotation issue and fix safe area issue --- index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/index.js b/index.js index 5c94a58..61df296 100644 --- a/index.js +++ b/index.js @@ -32,6 +32,7 @@ class Select2 extends Component { animatedHeight = new Animated.Value(INIT_HEIGHT); componentDidMount() { + Dimensions.addEventListener("change", this.handleDimensionChange); this.init(); }; @@ -39,6 +40,16 @@ class Select2 extends Component { this.init(newProps); } + componentWillUnmount() { + Dimensions.removeEventListener("change", this.handleDimensionChange) + }; + + handleDimensionChange = e => { + const { height } = e.window; + const INIT_HEIGHT = height * 0.6; + this.animatedHeight.setValue(INIT_HEIGHT); + } + init(newProps) { let preSelectedItem = []; let { data } = newProps || this.props; @@ -148,6 +159,7 @@ class Select2 extends Component { animationOutTiming={300} hideModalContentWhileAnimating isVisible={show}> + @@ -215,6 +227,7 @@ class Select2 extends Component { style={[styles.button, buttonStyle, { marginLeft: 5, marginRight: 10 }]} /> + { preSelectedItem.length > 0 From efab9f9de36f0d5738eeaa470505161ea6f63a37 Mon Sep 17 00:00:00 2001 From: Fodor Bence Date: Tue, 28 Jan 2020 14:07:09 +0100 Subject: [PATCH 2/2] SafeArea imported, loadFont used to load material fonts --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 61df296..35af10e 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,8 @@ //import liraries import React, { Component } from 'react'; -import { Text, StyleSheet, TouchableOpacity, View, FlatList, TextInput, Dimensions, Animated, Platform } from 'react-native'; +import { Text, StyleSheet, TouchableOpacity, View, FlatList, TextInput, Dimensions, Animated, Platform, SafeAreaView } from 'react-native'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; +Icon.loadFont(); import Modal from 'react-native-modal'; import Button from './lib/Button'; import TagItem from './lib/TagItem';