A framework for building native macOS apps with React.
Перейти к файлу
fabriziobertoglio1987 52aee50a70 underlineColor transparent not working on API 21 (#30897)
Summary:
This issue fixes https://github.com/facebook/react-native/issues/29379 `underlineColorAndroid'='transparent'` does not work on Android API 21.
Setting `style: { bottomBorderColor: 'transparent'}` fixes the issue.

The following steps fix underlineColorAndroid on Android API 21:
- Store the bottomBorderColor in a local variable
- Then set the bottomBorderColor to the same color of underlineColorAndroid
- Set underlineColorAndroid
- Then Set the bottomBorderColor to the previous color previously stored in the local variable

This change requires `ReactViewBackgroundDrawable` method `getBorderColor` to be public and accessible from `ReactTextInputManager` to retrieve the border color.

6061b79283/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java (L1231-L1236)

Related Discussions https://github.com/facebook/react-native/issues/18938 https://github.com/facebook/react-native/pull/18988 https://github.com/facebook/react-native/issues/29412#issuecomment-773412466

More Information at https://github.com/fabriziobertoglio1987/react-native-notes/issues/4#issuecomment-1029780852

## Changelog

[Android] [Fixed] - Fix underlineColorAndroid transparent not working on API 21

Pull Request resolved: https://github.com/facebook/react-native/pull/30897

Test Plan:
This changes fix the Java API which can not be tested as explained in commit 709a441ecf
The java TextInputTest was excluded from the test suite in commit 709a441ecf as they need the Yoga libraries to run

**<details><summary>CLICK TO OPEN TESTS RESULTS - API 21</summary>**
<p>

Does not show underline by default (`transparent`)

```javascript
<TextInput />
```

<image src="https://user-images.githubusercontent.com/24992535/107060953-dee34d00-67d7-11eb-8f01-360dbb1420b8.png" width="150" />

```javascript
<TextInput underlineColorAndroid="red" />
```

<image src="https://user-images.githubusercontent.com/24992535/107061134-194cea00-67d8-11eb-9da1-9780b1aa8294.png" width="150" />

```javascript
<TextInput
  underlineColorAndroid="green"
  style={
     {
        borderBottomColor: 'red',
        borderBottomWidth: 2,
        borderTopColor: 'black',
        borderTopWidth: 4
     }
   }
/>
```

<image src="https://user-images.githubusercontent.com/24992535/107062411-9167df80-67d9-11eb-810c-749992d8d2d3.png" width="150" />

```javascript
<TextInput
  style={
     {
        borderBottomColor: 'red',
        borderBottomWidth: 2,
        borderTopColor: 'black',
        borderTopWidth: 4
     }
   }
/>
```

<image src="https://user-images.githubusercontent.com/24992535/107062735-e6a3f100-67d9-11eb-93c3-02cd768f8421.png" width="150" />

```javascript
<TextInput
  underlineColorAndroid="blue"
  style={
    {
      borderBottomColor: 'red',
      borderBottomWidth: 2,
      borderTopColor: 'black',
      borderTopWidth: 4,
      borderLeftColor: 'pink',
      borderLeftWidth: 7,
      borderRightColor: 'yellow',
      borderRightWidth: 7,
    }
  }
/>
```

<image src="https://user-images.githubusercontent.com/24992535/107063263-75b10900-67da-11eb-97ab-316736d525a2.png" width="150" />

```javascript
<TextInput
  underlineColorAndroid="transparent"
  style={
    {
      borderBottomColor: 'red',
      borderBottomWidth: 2,
      borderTopColor: 'black',
      borderTopWidth: 4,
      borderLeftColor: 'pink',
      borderLeftWidth: 7,
      borderRightColor: 'yellow',
      borderRightWidth: 7,
    }
  }
/>
```

<image src="https://user-images.githubusercontent.com/24992535/107063332-8792ac00-67da-11eb-82fc-99793bf4d49d.png" width="150" />

</p>
</details>

Reviewed By: cortinico

Differential Revision: D33906415

Pulled By: lunaleaps

fbshipit-source-id: bd7efe4aac40ad701aec83f051ac40dcd4a99cda
2022-03-10 11:23:33 -08:00
.bundle Introduce Gemfile, ruby-version (#32303) 2021-10-01 21:22:26 -07:00
.circleci Build hermesc on Circle CI (#33393) 2022-03-07 17:02:08 -08:00
.github ci: Bump actions-apply-version-label to 0.0.3 (#32979) 2022-01-28 06:10:35 -08:00
IntegrationTests Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
Libraries fix: typos (#33040) 2022-03-08 03:58:58 -08:00
React Hook EarlyJsErrorHandler 2022-03-10 10:25:32 -08:00
ReactAndroid underlineColor transparent not working on API 21 (#30897) 2022-03-10 11:23:33 -08:00
ReactCommon BUCK: define GLOG_NO_ABBREVIATED_SEVERITIES everywhere 2022-03-08 12:35:48 -08:00
bots RN: Upgrade `bots/` Dependencies 2022-02-16 00:23:59 -08:00
docs Generate doc info for RN components 2019-09-19 18:36:25 -07:00
flow Deprecate nonstandard Promise.prototype.done 2022-02-17 09:15:03 -08:00
flow-typed/npm RN: Remove DeprecatedPropTypes 2022-01-20 18:17:03 -08:00
gradle Allow to setup a Gradle Enterprise instance via an external script 2022-02-16 06:37:56 -08:00
jest Remove `@babel/plugin-transform-object-assign` from preprocessor 2022-02-11 06:11:05 -08:00
keystores Use fb_native_wrapper for all targets 2018-10-31 11:47:42 -07:00
local-cli Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
packages Fix: Android react.gradle VmCleanup when packaging as library (#33179) 2022-03-08 13:35:28 -08:00
repo-config deploy 0.172.0 2022-03-04 12:01:41 -08:00
scripts Relative path support for app_path added 2022-03-10 04:34:53 -08:00
template deploy 0.172.0 2022-03-04 12:01:41 -08:00
third-party-podspecs Include folly fabric headers in source files (#33188) 2022-02-28 04:56:36 -08:00
tools/build_defs Fix OSS BUCK codegen (#33197) 2022-02-28 20:21:35 -08:00
.buckconfig Download kotlin compiler JARs for Buck instead of checking them in (#33209) 2022-03-02 13:04:49 -08:00
.buckjavaargs limiting BUCK's memory for CI 2016-02-01 10:49:33 -08:00
.clang-format Moving ObjC specific clang-format rules to the common config 2019-02-11 13:07:09 -08:00
.editorconfig Revert removal of CRLF from Windows bat files (#31398) 2021-09-09 22:44:32 -07:00
.eslintignore Lint: fix few "no-unused-var" warnings for imports (#30157) 2020-10-26 17:19:14 -07:00
.eslintrc Rename eslint-plugin-codegen to eslint-plugin-specs (#32698) 2021-12-02 20:47:12 -08:00
.flowconfig deploy 0.172.0 2022-03-04 12:01:41 -08:00
.flowconfig.android deploy 0.172.0 2022-03-04 12:01:41 -08:00
.gitignore Setup a Gradle build inside `ReactAndroid/hermes-engine` to download Hermes sources 2022-03-04 07:27:13 -08:00
.prettierrc JS: Upgrade to Prettier v2.4.1 [1/n] 2021-11-02 22:14:16 -07:00
.ruby-version Introduce Gemfile, ruby-version (#32303) 2021-10-01 21:22:26 -07:00
BUCK Use @synthesize viewRegistry_DEPRECATED for Keyframes to remove RCTWeakViewHolder hack 2022-02-25 13:45:22 -08:00
CHANGELOG.md Changelog for 0.67.3 (#33162) 2022-02-22 08:23:40 -08:00
CODE_OF_CONDUCT.md docs: add new version convenant contribuitor guide link (#32107) 2021-08-30 10:18:11 -07:00
CONTRIBUTING.md fix: Updated releases/changelog links (#32551) 2021-11-08 09:25:47 -08:00
ECOSYSTEM.md docs: fix url for chainreactconf (#30199) 2020-10-19 07:35:37 -07:00
Gemfile Introduce Gemfile, ruby-version (#32303) 2021-10-01 21:22:26 -07:00
Gemfile.lock iOS Ruby Updates (#32456) 2021-10-21 15:58:18 -07:00
LICENSE Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
LICENSE-docs More licenses 2015-03-24 19:59:10 -07:00
README.md fix: Updated releases/changelog links (#32551) 2021-11-08 09:25:47 -08:00
React-Core.podspec Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
React.podspec Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
build.gradle.kts build: Bump AGP to 7.1.1 and fix bundle inclusion in release mode (#33057) 2022-02-21 06:23:31 -08:00
cli.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
gradle.properties Increase max heap size for template gradle build 2022-02-02 12:56:54 -08:00
gradlew bump gradle to 7.3 (#32588) 2021-11-15 06:47:39 -08:00
gradlew.bat Re-sync with internal repository (#32212) 2021-09-15 10:45:06 +01:00
index.js Move the `SegmentedComponentIOS` away from React Native Core (#33140) 2022-02-21 05:23:16 -08:00
interface.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
jest-preset.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
jest.config.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
metro.config.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
package.json deploy 0.172.0 2022-03-04 12:01:41 -08:00
react-native.config.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
react.gradle Fix: Android react.gradle VmCleanup when packaging as library (#33179) 2022-03-08 13:35:28 -08:00
rn-get-polyfills.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
runXcodeTests.sh Use realpath instead of readlink 2022-02-22 02:23:02 -08:00
settings.gradle.kts Setup a Gradle build inside `ReactAndroid/hermes-engine` to download Hermes sources 2022-03-04 07:27:13 -08:00
template.config.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
yarn.lock deploy 0.172.0 2022-03-04 12:01:41 -08:00

README.md

React Native

Learn once, write anywhere:
Build mobile apps with React.

React Native is released under the MIT license. Current CircleCI build status. Current npm package version. PRs welcome! Follow @reactnative

Getting Started · Learn the Basics · Showcase · Contribute · Community · Support

React Native brings React's declarative UI framework to iOS and Android. With React Native, you use native UI controls and have full access to the native platform.

  • Declarative. React makes it painless to create interactive UIs. Declarative views make your code more predictable and easier to debug.
  • Component-Based. Build encapsulated components that manage their state, then compose them to make complex UIs.
  • Developer Velocity. See local changes in seconds. Changes to JavaScript code can be live reloaded without rebuilding the native app.
  • Portability. Reuse code across iOS, Android, and other platforms.

React Native is developed and supported by many companies and individual core contributors. Find out more in our ecosystem overview.

Contents

📋 Requirements

React Native apps may target iOS 11.0 and Android 5.0 (API 21) or newer. You may use Windows, macOS, or Linux as your development operating system, though building and running iOS apps is limited to macOS. Tools like Expo can be used to work around this.

🎉 Building your first React Native app

Follow the Getting Started guide. The recommended way to install React Native depends on your project. Here you can find short guides for the most common scenarios:

📖 Documentation

The full documentation for React Native can be found on our website.

The React Native documentation discusses components, APIs, and topics that are specific to React Native. For further documentation on the React API that is shared between React Native and React DOM, refer to the React documentation.

The source for the React Native documentation and website is hosted on a separate repo, @facebook/react-native-website.

🚀 Upgrading

Upgrading to new versions of React Native may give you access to more APIs, views, developer tools, and other goodies. See the Upgrading Guide for instructions.

React Native releases are discussed in this discussion repo.

👏 How to Contribute

The main purpose of this repository is to continue evolving React Native core. We want to make contributing to this project as easy and transparent as possible, and we are grateful to the community for contributing bug fixes and improvements. Read below to learn how you can take part in improving React Native.

Code of Conduct

Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read the full text so that you can understand what actions will and will not be tolerated.

Contributing Guide

Read our Contributing Guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to React Native.

Open Source Roadmap

You can learn more about our vision for React Native in the Roadmap.

Good First Issues

We have a list of good first issues that contain bugs which have a relatively limited scope. This is a great place to get started, gain experience, and get familiar with our contribution process.

Discussions

Larger discussions and proposals are discussed in @react-native-community/discussions-and-proposals.

📄 License

React Native is MIT licensed, as found in the LICENSE file.

React Native documentation is Creative Commons licensed, as found in the LICENSE-docs file.