question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TextField not shown on iOS

See original GitHub issue

Hi,

I am trying to use MKTextField on iOS and it is not displayed at all in the simulator. It is working on Android.

Version: RN: 0.27.2 RNMK: 0.3.2 iOS: 9.3

This is the expected result (on Android simulator): image

This is how it looks like on iOS simulator: image

They grey area is the place where the two MKTextField components are supposed to be.

Here is the JS code snippet:

import React from 'react';
import BaseReactComponent from '../common/BaseReactComponent';

import { View, StyleSheet } from 'react-native';
import { MKTextField, MKColor } from 'react-native-material-kit';
import PrimaryRaisedButton from '../common/buttons/PrimaryRaisedButton';
import {
    TEXTFIELD_WITH_FLOATING_LABEL,
    COMMON_STYLES
} from '../../styles/styles';

export default class LoginForm extends BaseReactComponent {
    constructor () {
        super();
        this._bindClassMethods('_setInitialState', '_handleLogin');
        this._setInitialState();
    }

    _setInitialState () {
        this.state = {
            username: '',
            password: ''
        };
    }

    render () {
        return (
            <View style={ [loginFormStyles.loginFormContainer, COMMON_STYLES.MARGIN_TOP_LG] }>
                <MKTextField
                    style={ [TEXTFIELD_WITH_FLOATING_LABEL] }
                    keyboardType="email-address"
                    floatingLabelEnabled={ true }
                    highlightColor={ MKColor.Blue }
                    placeholder="Email Address" />

                <MKTextField
                    style={ TEXTFIELD_WITH_FLOATING_LABEL }
                    password={ true }
                    floatingLabelEnabled={ true }
                    highlightColor={ MKColor.Blue }
                    placeholder="Password" />

                <PrimaryRaisedButton
                    text='LOGIN'
                    onPress={ this._handleLogin } />

            </View>
        );
    }
}

const loginFormStyles = StyleSheet.create({
    loginFormContainer: {
        alignItems: 'center'
    }
});

Thanks!

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:9

github_iconTop GitHub Comments

5reactions
ishabocommented, Jan 10, 2017

I was able to tackle that by setting the height on textInputStyle as well.

0reactions
abuammarcommented, Dec 21, 2017

i tried all the above , nothing worked

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to solve TextField text Not displaying in IOS Version 13.2 ...
In iOS 13 Dark mode Your Text color will not be visible. If you didn't set it. If you assign System colors dark...
Read more >
Text Fields don't appear in stack view? - Apple Developer
Text Fields don't appear in stack view? ... I am using Xcode 11 for a macOS app. When I add a text field(s)...
Read more >
text field not receiving input via iPhone simulator
Basically, I just added code to hide the "receivedElement" and show my new "loginElement". It displays just fine, but it won't let me...
Read more >
TextField.text=number 0 does not shown in iOS. #9846 - GitHub
Since number may be assigned to TextField.text (For example, ListView's item has number 0 field), it is desirable to match Android. Beta Was...
Read more >
How to read text from a TextField - Hacking with Swift
There are two important provisos when working with text fields. First, they don't have a border by default, so you probably won't see...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found