cljsrn

Gabriele Lippi 2024-10-10T16:41:10.790099Z

Hello, I hope this is the right channel to ask this question. I'm working on a project that uses krell and reagent + react-native I need to translate this code but I don't understand how to do that

<Animated.View
        style={[
          styles.fadingContainer,
          {
            // Bind opacity to animated value
            opacity: fadeAnim,
          },
        ]}>
        <Text style={styles.fadingText}>Fading View!</Text>
      </Animated.View>
Any suggestions? Thanks!

hadils 2024-10-10T16:48:35.304119Z

Hi @gabriele.lippi91! Welcome to the React Native family! There are several steps needed to translate this code: 1. Animated.View -> (.View /Animated...) 2. Style is just a map, so you can manipulate it just like a CLJS map. 3. Don’t forget to use the clj->js function to convert your map into a JS map. Let me know if you need more information.

Gabriele Lippi 2024-10-10T16:52:04.122409Z

First of all thank you very much @hadilsabbagh18!

Gabriele Lippi 2024-10-10T16:53:40.235939Z

I'm afraid I still don't have clear how to import in particular for Animated.View I'm trying this but it seems to be wrong still

(ns some-name-space
 (:require
   [reagent.core :as reagent]
   [react-native :as rn]))

(defn animated-view []
  [:> (.View rn/Animated)])

Gabriele Lippi 2024-10-10T16:57:22.594289Z

Ideally I'm trying to have something similar to this:

(def text (r/adapt-react-class rn/Text))

joshmiller 2024-10-13T05:47:01.247839Z

View is a property of Animated, so it should be something like (.-View rn/Animated)

🙌 1