{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/12160","repository_url":"https://api.github.com/repos/facebook/react-native","labels_url":"https://api.github.com/repos/facebook/react-native/issues/12160/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/12160/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/12160/events","html_url":"https://github.com/facebook/react-native/issues/12160","id":204745645,"number":12160,"title":"TextInput ignores dynamic textAlign","user":{"login":"alanhoff","id":1044223,"avatar_url":"https://avatars3.githubusercontent.com/u/1044223?v=4","gravatar_id":"","url":"https://api.github.com/users/alanhoff","html_url":"https://github.com/alanhoff","followers_url":"https://api.github.com/users/alanhoff/followers","following_url":"https://api.github.com/users/alanhoff/following{/other_user}","gists_url":"https://api.github.com/users/alanhoff/gists{/gist_id}","starred_url":"https://api.github.com/users/alanhoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alanhoff/subscriptions","organizations_url":"https://api.github.com/users/alanhoff/orgs","repos_url":"https://api.github.com/users/alanhoff/repos","events_url":"https://api.github.com/users/alanhoff/events{/privacy}","received_events_url":"https://api.github.com/users/alanhoff/received_events","type":"User","site_admin":false},"labels":[{"id":470317962,"url":"https://api.github.com/repos/facebook/react-native/labels/Icebox","name":"Icebox","color":"ededed","default":false},{"id":257497884,"url":"https://api.github.com/repos/facebook/react-native/labels/iOS","name":"iOS","color":"c7def8","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-02-02T00:13:43Z","updated_at":"2017-07-26T05:45:10Z","closed_at":null,"body":"### Description\r\n\r\nI have a text input that have a dynamic `textAlign` style. When I focus the input it should have `textAlign: left` and `textAlign: center` when blurred and empty text. This is the way that I found to place the placeholder in the middle without centering what the user types. Everything works fine until I blur the input. The textAlign will stay in the left and the placeholder isn't centered anymore. \r\n\r\n### Reproduction\r\n\r\n```jsx\r\nrender () {\r\n  const shouldCenter = !this.state.text && !this.state.focused\r\n\r\n  return <TextInput\r\n    multiline\r\n    value={this.state.text}\r\n    style={{ textAlign: shouldCenter ? 'center' : 'left' }}\r\n    onFocus={() => this.setState({ focused: true })}\r\n    onBlur={() => this.setState({ focused: false })}\r\n    onChangeText={text => this.setState({ text })}\r\n    placeholder={shouldCenter ? 'This should always be on center' : null} />\r\n}\r\n```\r\n\r\n### Solution\r\n\r\nAs a short-term solution I added a `key={this.state.key}` to the input and changed the key each time the input is blurred and have no text. I think this forces the correct redraw of the input and the placeholder appears in the center correctly.\r\n\r\n### Additional Information\r\n\r\n* React Native version: 0.39.0\r\n* React version: 15.4.1\r\n* Platform: Darwin user.local 15.6.0 Darwin Kernel Version 15.6.0: Mon Jan  9 23:07:29 PST 2017; root:xnu-3248.60.11.2.1~1/RELEASE_X86_64 x86_64\r\n* Operating System: Simulator Version 10.0 (SimulatorApp-726.7 ) running iPhone 6 - iOS 10.2 (14C89)\r\n* Xcode: Version 8.2.1 (8C1002)\r\n"},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/317953868","html_url":"https://github.com/facebook/react-native/issues/12160#issuecomment-317953868","issue_url":"https://api.github.com/repos/facebook/react-native/issues/12160","id":317953868,"user":{"login":"hramos","id":165856,"avatar_url":"https://avatars3.githubusercontent.com/u/165856?v=4","gravatar_id":"","url":"https://api.github.com/users/hramos","html_url":"https://github.com/hramos","followers_url":"https://api.github.com/users/hramos/followers","following_url":"https://api.github.com/users/hramos/following{/other_user}","gists_url":"https://api.github.com/users/hramos/gists{/gist_id}","starred_url":"https://api.github.com/users/hramos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hramos/subscriptions","organizations_url":"https://api.github.com/users/hramos/orgs","repos_url":"https://api.github.com/users/hramos/repos","events_url":"https://api.github.com/users/hramos/events{/privacy}","received_events_url":"https://api.github.com/users/hramos/received_events","type":"User","site_admin":false},"created_at":"2017-07-26T05:45:10Z","updated_at":"2017-07-26T05:45:10Z","body":"Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!\n\nIf you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:\n\n- Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.\n- If so, is there any information missing from the bug report? Post a comment with all the information required by the [issue template](https://github.com/facebook/react-native/blob/master/.github/ISSUE_TEMPLATE.md).\n- Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.\n\nIf you would like to work on a patch to fix the issue, *contributions are very welcome*! Read through the [contribution guide](http://facebook.github.io/react-native/docs/contributing.html), and feel free to hop into [#react-native](https://discordapp.com/invite/0ZcbPKXt5bZjGY5n) if you need help planning your contribution.\n"}}
{"actor":{"display_login":"hramos"}}