Code Monkey home page Code Monkey logo

Comments (8)

Ehesp avatar Ehesp commented on July 20, 2024

Right so this is because I swapped out the Ripple component with the RN Ripple, which only supports API 21 upwards.

I can look at bringing it back in if I can somehow get the api version, but 16 is an old api version?

EDIT: Right so what I'll do is bring back the Ripple as a Polyfill for older versions

var {Platform} = React;

if(Platform.Version === '5.0'){
  console.log('Running on Lollipop!');
}

I need to figure out what versions run what APIs though.

from react-native-material-design.

pewh avatar pewh commented on July 20, 2024

Currently you can get android api version via Android build class or use react-native-device-info. But it will make this package installation more complicated.

api 16 is an old version, but many devices still use this version.

By the way, what is the different between Ripple component and RN Ripple? Performance?

from react-native-material-design.

Ehesp avatar Ehesp commented on July 20, 2024

It's okay, I can do something like this:

Performance wasn't actually as much of an issue, it was more complexity along with a few bugs. I'll bring it back though.

@pewh What happens when you create a View, and add an elevation to it? From here elevation is only available on API 21+. Does it throw an error or simply ignore it?

from react-native-material-design.

pewh avatar pewh commented on July 20, 2024

Thanks, @Ehesp

<View elevation={4}><Text>foo</Text></View> doesn't throw any error. It also render text & no warning on console.

from react-native-material-design.

Ehesp avatar Ehesp commented on July 20, 2024

Hi @pewh

I've just committed to master (472383d). I've tested this as best I could but I was unable to get my emulator working on API 16. Basically it checks whether the device has the correct API level for a feature, and if not returns a polyfill for it.

The Ripple pollyfill had to be changed a bit, as I also wanted to implement onLongPress and elevation too. I've implemented this on Button & Drawer.Section. Could you test whether it works for me?

A couple of things I've noticed are:

  • On press, the background color isn't there, where as natively it is (I can do this, just need to find out what opacity of the ripple color the background color is).
  • With native, long pressing the button also seems to trigger a normal press. This currently doesn't happen... Need to figure out the actual logic behind this, surely triggering both functions for a long press is a bad idea.

from react-native-material-design.

Ehesp avatar Ehesp commented on July 20, 2024

Got API 16 working... Added more fixes in, including a border on components if elevation isn't available.

from react-native-material-design.

pewh avatar pewh commented on July 20, 2024

Sorry for long delay. I've testing on several devices with API 16 and everything is work. Thanks for the great work 👍

from react-native-material-design.

Ehesp avatar Ehesp commented on July 20, 2024

Good to hear, I'm not sure the onLongPress is how I want it yet. I need to properly dig into the logic behind it as it seems to be functioning differently to native at the moment.

from react-native-material-design.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.