الفرق بين المراجعتين ل"ReactNative/activityindicator"

من موسوعة حسوب
اذهب إلى التنقل اذهب إلى البحث
سطر 3: سطر 3:
  
 
==مثال==
 
==مثال==
 +
 +
* مثال لمكون الصنف (Class Component)
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">
import React, { Component } from 'react'
+
import React, { Component } from "react";
import {
+
import { ActivityIndicator, StyleSheet, Text, View } from "react-native";
  ActivityIndicator,
 
  AppRegistry,
 
  StyleSheet,
 
  Text,
 
  View,
 
} from 'react-native'
 
  
export default class App extends Component {
+
class App extends Component {
 
   render() {
 
   render() {
 
     return (
 
     return (
 
       <View style={[styles.container, styles.horizontal]}>
 
       <View style={[styles.container, styles.horizontal]}>
         <ActivityIndicator size="large" color="#0000ff" />
+
         <ActivityIndicator />
         <ActivityIndicator size="small" color="#00ff00" />
+
         <ActivityIndicator size="large" />
         <ActivityIndicator size="large" color="#0000ff" />
+
         <ActivityIndicator size="small" color="#0000ff" />
         <ActivityIndicator size="small" color="#00ff00" />
+
         <ActivityIndicator size="large" color="#00ff00" />
 
       </View>
 
       </View>
     )
+
     );
 
   }
 
   }
 
}
 
}
سطر 29: سطر 25:
 
   container: {
 
   container: {
 
     flex: 1,
 
     flex: 1,
     justifyContent: 'center'
+
     justifyContent: "center"
 +
  },
 +
  horizontal: {
 +
    flexDirection: "row",
 +
    justifyContent: "space-around",
 +
    padding: 10
 +
  }
 +
});
 +
 
 +
export default App;
 +
</syntaxhighlight>
 +
 
 +
* مثال لمكون الدالة (Function Component)
 +
<syntaxhighlight lang="javascript">
 +
import React from "react";
 +
import { ActivityIndicator, StyleSheet, Text, View } from "react-native";
 +
 
 +
const App = () => (
 +
  <View style={[styles.container, styles.horizontal]}>
 +
    <ActivityIndicator />
 +
    <ActivityIndicator size="large" />
 +
    <ActivityIndicator size="small" color="#0000ff" />
 +
    <ActivityIndicator size="large" color="#00ff00" />
 +
  </View>
 +
);
 +
 
 +
const styles = StyleSheet.create({
 +
  container: {
 +
    flex: 1,
 +
    justifyContent: "center"
 
   },
 
   },
 
   horizontal: {
 
   horizontal: {
     flexDirection: 'row',
+
     flexDirection: "row",
     justifyContent: 'space-around',
+
     justifyContent: "space-around",
 
     padding: 10
 
     padding: 10
 
   }
 
   }
})
+
});
  
AppRegistry.registerComponent('App', () => App)
+
export default App;
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 
== الخاصيات ==
 
== الخاصيات ==
 
* [[ReactNative/view|خاصيّات <code>View</code>]]
 
* [[ReactNative/view|خاصيّات <code>View</code>]]
سطر 48: سطر 74:
  
 
===<code>animating</code>===
 
===<code>animating</code>===
إظهار المؤشر (true، وهي القيمة الافتراضيّة) أو إخفاؤه (false).
+
إظهار المؤشر (true) أو إخفاؤه (false).
  
 
{| class="wikitable"
 
{| class="wikitable"
 
!النوع
 
!النوع
 
!مطلوب
 
!مطلوب
 +
!القيمة الافتراضية
 
|-
 
|-
 
|قيمة منطقيّة
 
|قيمة منطقيّة
 
|لا
 
|لا
 +
|true
 
|}
 
|}
 
===<code>color</code>===
 
===<code>color</code>===
لون المؤشّر (الافتراضي هو الرمادي على نظام التشغيل iOS والسماوي الغامق على نظام Android).
+
لون المؤشّر .
  
 
{| class="wikitable"
 
{| class="wikitable"
 
!النوع
 
!النوع
 
!مطلوب
 
!مطلوب
 +
!القيمة الافتراضية
 
|-
 
|-
 
|[[ReactNative/colors|color]]
 
|[[ReactNative/colors|color]]
 
|لا
 
|لا
 +
|<code>الرمادي '#999999'</code> على نظام التشغيل iOS
 +
 +
<code>null</code> (اللون الافتراضي للنظام) في نظام Android
 
|}
 
|}
  
 
===<code>hidesWhenStopped</code>===
 
===<code>hidesWhenStopped</code>===
ما إذا كان يجب إخفاء المؤشر عند عدم تحريكه (animating) (القيمة true افتراضيًا).
+
ما إذا كان يجب إخفاء المؤشر عند عدم تحريكه (animating).
 
{| class="wikitable"
 
{| class="wikitable"
 
!النوع
 
!النوع
 
!مطلوب
 
!مطلوب
 +
!القيمة الافتراضية
 
!المنصة
 
!المنصة
 
|-
 
|-
 
|قيمة منطقيّة
 
|قيمة منطقيّة
 
|لا
 
|لا
 +
|true
 
|iOS
 
|iOS
 
|}
 
|}
 
===<code>size</code>===
 
===<code>size</code>===
حجم المؤشر ("small" افتراضيًا). تمرير عددٍ إلى هذه الخاصيّة مدعوم فقط على Android.
+
حجم المؤشر.
 
{| class="wikitable"
 
{| class="wikitable"
 
!النوع
 
!النوع
 
!مطلوب
 
!مطلوب
 +
!القيمة الافتراضية
 +
|-
 +
|enum('small', 'large')
 +
| rowspan="2" |لا
 +
| rowspan="2" |'small'
 
|-
 
|-
|enum('small', 'large') أو عدد
+
|عدد على Android
|لا
 
 
|}
 
|}
 
== مصادر ==
 
== مصادر ==
 
* [https://facebook.github.io/react-native/docs/activityindicator صفحة ActivityIndicator في توثيق React Native الرسمي.]
 
* [https://facebook.github.io/react-native/docs/activityindicator صفحة ActivityIndicator في توثيق React Native الرسمي.]
 
[[تصنيف:ReactNative]]
 
[[تصنيف:ReactNative]]

مراجعة 17:49، 2 أبريل 2021

يعرض مؤشّر تحميل دائريّ.

مثال

  • مثال لمكون الصنف (Class Component)
import React, { Component } from "react";
import { ActivityIndicator, StyleSheet, Text, View } from "react-native";

class App extends Component {
  render() {
    return (
      <View style={[styles.container, styles.horizontal]}>
        <ActivityIndicator />
        <ActivityIndicator size="large" />
        <ActivityIndicator size="small" color="#0000ff" />
        <ActivityIndicator size="large" color="#00ff00" />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: "center"
  },
  horizontal: {
    flexDirection: "row",
    justifyContent: "space-around",
    padding: 10
  }
});

export default App;
  • مثال لمكون الدالة (Function Component)
import React from "react";
import { ActivityIndicator, StyleSheet, Text, View } from "react-native";

const App = () => (
  <View style={[styles.container, styles.horizontal]}>
    <ActivityIndicator />
    <ActivityIndicator size="large" />
    <ActivityIndicator size="small" color="#0000ff" />
    <ActivityIndicator size="large" color="#00ff00" />
  </View>
);

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: "center"
  },
  horizontal: {
    flexDirection: "row",
    justifyContent: "space-around",
    padding: 10
  }
});

export default App;

الخاصيات

animating

إظهار المؤشر (true) أو إخفاؤه (false).

النوع مطلوب القيمة الافتراضية
قيمة منطقيّة لا true

color

لون المؤشّر .

النوع مطلوب القيمة الافتراضية
color لا الرمادي '#999999' على نظام التشغيل iOS

null (اللون الافتراضي للنظام) في نظام Android

hidesWhenStopped

ما إذا كان يجب إخفاء المؤشر عند عدم تحريكه (animating).

النوع مطلوب القيمة الافتراضية المنصة
قيمة منطقيّة لا true iOS

size

حجم المؤشر.

النوع مطلوب القيمة الافتراضية
enum('small', 'large') لا 'small'
عدد على Android

مصادر