abdurrahmanekr / bana-istedigini-sor

Yeni paylaştığım yazılardan haberdar olmak için bloguma abone olun:
https://avarekodcu.com
12 stars 1 forks source link

React Native ScrollView sorunu #32

Closed aozfen closed 6 years ago

aozfen commented 6 years ago

Login ekranı yapıyorum ama şöyle bi sıkıntı var ekran yan döndüğü zaman bazı companentler aşağıya kayıyor bunun için scrollview koyuyorum ancak dikey konumda scrollview heightini full yapmıyor. Ben height: 100% veriyorum bu seferde yatay konumda scrollview çalışmıyor.

Dosya yapısı şöyle

node_modules App.js components -Login --index.js --RegisterView.js --LoginView.js

App.js ` render() { return (

  <View style={styles.container}>
    <Login />
  </View>

);

} ` components/Login/index.js

` render() {

    return (
        <ScrollView style={{height:'100%', position:'absolute', width:'100%', backgroundColor: '#cc2e38'}}>
            <Image style={styles.bgImage} source={require('../..//assets/images/home.jpg')} />
            <View style={styles._black}>
                <KeyboardAvoidingView behavior="position" style={{ marginTop: 80, alignItems: 'center', }}>
                    {this.state.fontLoaded ? ( 
                    <View>
                        <Text style={{ fontFamily: 'Audiowide', fontSize: 50, color: '#fff' }} >
                            TİTLE
                        </Text>

                    </View>
                     ) : null}

                    {this.state.currentView === 1 ? <Login changeView={this.changeView} />
                    : this.state.currentView === 2 ? <Register changeView={this.changeView} />
                    : null } 
                </KeyboardAvoidingView>
            </View>
        </ScrollView>
    );
} `

components/Login/LoginView.js ` render() { return (

{this.state.fontLoaded ? ( Giriş yap ) : null} this.setState({ username })} value={this.state.username} underlineColorAndroid="transparent" autoCorrect={false} placeholder="Kullanıcı Adı" placeholderTextColor="#A1A1A1" /> this.setState({ password })} value={this.state.password} underlineColorAndroid="transparent" autoCorrect={false} placeholder="Şifre" placeholderTextColor="#A1A1A1" /> veya this.props.changeView(2)} >Hesabın yok mu? Kayıt ol.
        </View>
    )
}

`

abdurrahmanekr commented 6 years ago

Merhaba ScrollView'ın style'ı {position: 'absolute'} olduğu için olabilir. FlexBox kullanmanızı öneririm.

<ScrollView
    style={{
        display: 'flex',
        backgroundColor: '#cc2e38'
    }}></ScrollView>