Fork me on GitHub
#cljsrn
<
2020-04-26
>
mac08:04:36

For anybody using krell on Ubuntu with Android Studio and the Android Studio emulator, in addition to the steps described on github and the react native page, I had to run npm start in the project directory to get it to serve the files to the emulator.

dnolen11:04:11

@mac that's a bit odd - was pretty sure npx react-native run-foo would do that for you?

Shako Farhad12:04:16

Anyone here who have used the react-native-gesture-handler? I am trying to get this example working.

Shako Farhad12:04:49

This is what I have done:

Shako Farhad12:04:20

The (.-state nativeEvent) thing is just nil (it seems so). When using the .equals function that if does return true, and the alert does popup, but it does so on any kind of press not just longpress 😮

Shako Farhad12:04:05

Yeah the problem is that (.-state nativeEvent) is nil no matter what. Am I accessing it wrong? nvm! When in doubt, use (js-keys javascriptObject) 😄 I got a list of all the attributes, and obviously I wasn't accessing the correct one from start. Need to do (.-state (.-nativeEvent events)).

mac12:04:01

@dnolen Apparently not.

dnolen12:04:54

@mac so a known react native issue?

mac12:04:13

@dnolen If I read this https://reactnative.dev/docs/environment-setup#native correctly it is not an issue but necessary to run the app. You need both npx react-native start (or npm start) and npx react-native run-android. So you might want to add it to the krell reagent tutorial.

dnolen12:04:39

huh ok, locally I've always seen the bundler auto start with run-android

dotemacs13:04:22

@shakof91 just to get a long press handling, why don’t you try this:

...
(:require [reagent.core :as r])

(def react-native (js/require "react-native"))
(def touchable-opacity (r/adapt-react-class (.-TouchableOpacity react-native)))
[touchable-opacity {:on-long-press #(js/alert "long press")}
   [text {} "long press"]]

Shako Farhad13:04:05

Oh! I didn't know you could do that with the regular react native. 😮 What I want to achieve with this gesture handler thing is to translate a view up and down or side to side, or even just moving a view around on the screen. So tap -> move -> release. What would you recommend for this kind of itneraction?

dotemacs13:04:55

You can create a view and within this view you can add a modal that pops in, from left/right/up or down, which is by default not visible. Then depending on some pre-defined value, the modal is either visible or not. By default it can be not visible and by the long press this boolean value becomes true, thus making it visible. Does that make sense?

Shako Farhad13:04:45

Really? You can make modals pop in from all sides and not just bottom? 😮

Shako Farhad13:04:59

How do you set the direction of the modal?

Shako Farhad13:04:38

Ah, using the community version. Alright. I will check it out! Thanks for your guidance as always 😄

👍 4
Michaël Salihi13:04:53

@dnolen @mac Yeah, same behavior for me on one of my setup (Ubuntu/Android Studio). I must always open one terminal to run npx react-native start and another for npx react-native run-android. Dunno why it's not always the case...depend on "something" in the setup

dnolen14:04:28

Ok will update the docs

dnolen15:04:27

updated the docs

👍 8