henninghall / react-native-date-picker

React Native Date Picker is datetime picker for Android and iOS. It includes date, time and datetime picker modes. The datepicker is customizable and is supporting different languages. It's written with native code to achieve the best possible look, feel and performance.
MIT License
2.25k stars 346 forks source link

Caused by: java.lang.OutOfMemoryError #257

Closed Vickshine closed 3 years ago

Vickshine commented 4 years ago

Open often, select times, and close。 It will be crash.(version: v3.2.4 android) log: System.err: android.view.InflateException: Binary XML file line #16: Binary XML file line #16: Error inflating class \ System.err: Caused by: android.view.InflateException: Binary XML file line #16: Error inflating class \ System.err: Caused by: java.lang.reflect.InvocationTargetException\ System.err: at java.lang.reflect.Constructor.newInstance0(Native Method)\ System.err: at android.view.View.inflate(View.java:21052)\ System.err: at com.henninghall.date_picker.PickerView.update(PickerView.java:36)\ System.err: at com.henninghall.date_picker.DatePickerManager.onAfterUpdateTransaction(DatePickerManager.java:68)\ System.err: at com.henninghall.date_picker.DatePickerManager.onAfterUpdateTransaction(DatePickerManager.java:28)\

henninghall commented 4 years ago

Hi @Vickshine , can you provide a code example of how you're using the picker?

Vickshine commented 4 years ago

Ok, just like this:

` <TouchableWithoutFeedback onPress={() => this.onRequestClose()}>

                </TouchableWithoutFeedback>

                <View style={styles.modelBottomStyle}>
                    <View style={styles.modelBottomTopStyle}>
                        <TouchableWithoutFeedback onPress={() => this.onRequestClose()}>
                            <View>
                                <Text style={styles.modelTopCancelStyle}>取消</Text>
                            </View>
                        </TouchableWithoutFeedback>
                        <Text style={styles.modelTopTitleStyle}>{title}</Text>
                    </View>
                    <DatePicker
                        style={styles.pickerStyle}
                        date={this.state.date}
                        mode="time"
                        timeZoneOffsetInMinutes={8*60}
                        onDateChange={(date) => {
                            this.setState({date: date})
                        }}
                    />
                    <BigButton buttonStyle={styles.saveStyle} title={sureText}
                               onPressEvent={() => this.sureBtnEvent()}/>
                </View>
            </View>

`

henninghall commented 3 years ago

Fixed in https://github.com/henninghall/react-native-date-picker/pull/286 and release in v3.2.8